home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / comm2 / xprz351s.lha / Xproto.h < prev    next >
C/C++ Source or Header  |  1994-11-19  |  8KB  |  233 lines

  1. /** xproto.h
  2.  *
  3.  *   Include file for External Protocol Handling
  4.  *   Updated to XPR3 level including 2.001 extensions 
  5.  *   by Robert Williamson 
  6.  *
  7.  **/
  8. /*
  9.    *   The structure
  10.  */
  11. struct XPR_IO
  12.   {
  13.     /* File name(s) */
  14.     char *xpr_filename;
  15.     /* Open file */
  16.     long (*__asm xpr_fopen) (
  17.                              register __a0 char *filename,
  18.                              register __a1 char *accessmode);
  19.     /* Close file */
  20.     long (*__asm xpr_fclose) (
  21.                              register __a0 long filepointer);
  22.     /* Get char from file */
  23.     long (*__asm xpr_fread) (
  24.                             register __a0 char *buffer,
  25.                             register __d0 long size,
  26.                             register __d1 long count,
  27.                             register __a1 long fileptr);
  28.     /* Put string to file */
  29.     long (*__asm xpr_fwrite) (
  30.                               register __a0 char *buffer,
  31.                               register __d0 long size,
  32.                               register __d1 long count,
  33.                               register __a1 long fileptr);
  34.     /* Get char from serial */
  35.     long (*__asm xpr_sread) (
  36.                              register __a0 char *buffer,
  37.                              register __d0 long size,
  38.                              register __d1 long timeout);
  39.     /* Put string to serial */
  40.     long (*__asm xpr_swrite) (
  41.                               register __a0 char *buffer,
  42.                               register __d0 long size);
  43.     /* Flush serial input buffer */
  44.     long (*xpr_sflush) (void);  
  45.  
  46.     /* Print stuff */
  47.     long (*__asm xpr_update) (
  48.                     register __a0 struct XPR_UPDATE * updatestruct);
  49.     /* Check for abort */
  50.     long (*xpr_chkabort) (void);  
  51.  
  52.     /* Check misc. stuff */
  53.     void (*xpr_chkmisc) (void);  
  54.  
  55.     /* Get string interactively */
  56.     long (*__asm xpr_gets) (
  57.                             register __a0 char *prompt,
  58.                             register __a1 char *buffer);
  59.     /* Set and Get serial info */
  60.     long (*__asm xpr_setserial) (
  61.                                 register __d0 long newstatus);
  62.  
  63.     /* Find first file name */
  64.     long (*__asm xpr_ffirst) (
  65.                               register __a0 char *buffer,
  66.                               register __a1 char *pattern);
  67.     /* Find next file name */
  68.     long (*__asm xpr_fnext) (
  69.                              register __d0 long oldstate,
  70.                              register __a0 char *buffer,
  71.                              register __a1 char *pattern);
  72.     /* Return file info */
  73.     long (*__asm xpr_finfo) (
  74.                              register __a0 char *filename,
  75.                              register __d0 long typeofinfo);
  76.     /* Seek in a file */
  77.     long (*__asm xpr_fseek) (
  78.                              register __a0 long fileptr,
  79.                              register __d0 long offset,
  80.                              register __d1 long origin);
  81.     /* Number of extensions */
  82.     long xpr_extension;
  83.  
  84.     /* Initialized by Setup. */
  85.     long *xpr_data;
  86.  
  87.     /* Multiple XPR options. */
  88.     long (*__asm xpr_options) (
  89.                                register __d0 long n,
  90.                                register __a0
  91.                                struct xpr_option ** opt);
  92.     /* Delete a file. */
  93.     long (*__asm xpr_unlink) (
  94.                               register __a0 char *filename);
  95.  
  96.     /* Query serial device */
  97.     long (*xpr_squery) (void);  
  98.  
  99.     /* Get various host ptrs */
  100.     long (*__asm xpr_getptr) (
  101.                               register __d0 long type);
  102.   };
  103. /*
  104.    *   Number of defined extensions
  105.  */
  106. #define XPR_EXTENSION 4L
  107.  
  108. /*
  109.    *   The functions
  110.  */
  111. #ifndef LATTICE
  112. extern long XProtocolSend (), XProtocolReceive (), XProtocolSetup (), XProtocolCleanup ();
  113. #endif
  114. /*
  115.    *   Flags returned by XProtocolSetup()
  116.  */
  117. #define XPRS_FAILURE    0x00000000L 
  118. #define XPRS_SUCCESS    0x00000001L 
  119.  
  120. #define XPRS_NORECREQ   0x00000002L 
  121. /* Protocol requires no communications program supplied file */
  122. /* requester for receive: either the XPR supplies the file  */
  123. /* requester or the protocol is capable of receiving file name  */
  124. /* information through other means (e.g., from the host). */
  125.  
  126. #define XPRS_NOSNDREQ   0x00000004L
  127. /* Protocol requires no communications program supplied file */
  128. /* requester for send: either the XPR supplies the file requester */
  129. /* or the protocol is capable of receiving file name information */
  130. /* through other means. */
  131.  
  132. #define XPRS_HOSTMON    0x00000008L
  133. /* Communications program is requested to call XProtocolHostMon() */
  134. /* for all serial port input */
  135.  
  136. #define XPRS_USERMON    0x00000010L
  137. /* Communications program is requested to call XProtocolUserMon() */
  138. /* for all user input */
  139.  
  140. #define XPRS_HOSTNOWAIT 0x00000020L
  141. /* Communications program is requested to call XProtocolHostMon() */
  142. /* without waiting for serial input */
  143.  
  144. #define XPRS_NOUPDATE   0x00008000L
  145. /* Communication program should not open transfer status screen */
  146.  
  147. #define XPRS_XPR2001    0x00010000L
  148. /* Protocol follows XPR2.001 definitions. */
  149. /* (Upload files are always open with mode "r") */
  150.  
  151. #define XPRS_DOUBLE     0x00020000L
  152. /* Protocol uses internal double buffer, xpr_swrite can */
  153. /* return immediately if previous xpr_swrite is done. */
  154. /* If previous xpr_swrite isn't done you must wait till */
  155. /* it's sent and return after that. Ie. comprog don't */
  156. /* wait current xpr_swrite. */
  157.  
  158. /*
  159.    *   The update structure
  160.  */
  161. struct XPR_UPDATE
  162.   {
  163.     long xpru_updatemask;
  164.     char *xpru_protocol;
  165.     char *xpru_filename;
  166.     long xpru_filesize;
  167.     char *xpru_msg;
  168.     char *xpru_errormsg;
  169.     long xpru_blocks;
  170.     long xpru_blocksize;
  171.     long xpru_bytes;
  172.     long xpru_errors;
  173.     long xpru_timeouts;
  174.     long xpru_packettype;
  175.     long xpru_packetdelay;
  176.     long xpru_chardelay;
  177.     char *xpru_blockcheck;
  178.     char *xpru_expecttime;
  179.     char *xpru_elapsedtime;
  180.     long xpru_datarate;
  181.     long xpru_status;
  182.     long xpru_reserved2;
  183.     long xpru_reserved3;
  184.     long xpru_reserved4;
  185.     long xpru_reserved5;
  186.   };
  187. /*
  188.    *   The possible bit values for the xpru_updatemask are:
  189.  */
  190. #define XPRU_PROTOCOL           0x00000001L
  191. #define XPRU_FILENAME           0x00000002L
  192. #define XPRU_FILESIZE           0x00000004L
  193. #define XPRU_MSG                0x00000008L
  194. #define XPRU_ERRORMSG           0x00000010L
  195. #define XPRU_BLOCKS             0x00000020L
  196. #define XPRU_BLOCKSIZE          0x00000040L
  197. #define XPRU_BYTES              0x00000080L
  198. #define XPRU_ERRORS             0x00000100L
  199. #define XPRU_TIMEOUTS           0x00000200L
  200. #define XPRU_PACKETTYPE         0x00000400L
  201. #define XPRU_PACKETDELAY        0x00000800L
  202. #define XPRU_CHARDELAY          0x00001000L
  203. #define XPRU_BLOCKCHECK         0x00002000L
  204. #define XPRU_EXPECTTIME         0x00004000L
  205. #define XPRU_ELAPSEDTIME        0x00008000L
  206. #define XPRU_DATARATE           0x00010000L
  207. #define XPRU_STATUS             0x00020000L
  208. #define XPRU_RESERVED2          0x00040000L
  209. #define XPRU_RESERVED3          0x00080000L
  210. #define XPRU_RESERVED4          0x00100000L
  211. #define XPRU_RESERVED5          0x00200000L
  212. #define XPRU_DNLOAD             0x40000000L
  213. #define XPRU_UPLOAD             0x80000000L
  214. /*
  215.    *   The xpro_option structure
  216.  */
  217. struct xpr_option
  218.   {
  219.     char *xpro_description; /* description of the option                  */
  220.     long xpro_type;         /* type of option                             */
  221.     char *xpro_value;       /* pointer to a buffer with the current value */
  222.     long xpro_length;       /* buffer size                                */
  223.   };
  224. /*
  225.    *   Valid values for xpro_type are:
  226.  */
  227. #define XPRO_BOOLEAN 1L     /* xpro_value is "yes", "no", "on" or "off"   */
  228. #define XPRO_LONG    2L     /* xpro_value is string representing a number */
  229. #define XPRO_STRING  3L     /* xpro_value is a string               */
  230. #define XPRO_HEADER  4L     /* xpro_value is ignored                */
  231. #define XPRO_COMMAND 5L     /* xpro_value is ignored                */
  232. #define XPRO_COMMPAR 6L     /* xpro_value contains command parameters     */
  233.